package org.example.Controller;

import org.example.Pojo.Roles;
import org.example.Service.Impl.RolesServiceImpl;
import org.example.Utils.RequirePermission;
import org.example.Utils.UnionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Roles")
public class RolesController {
    @Autowired
    private RolesServiceImpl rolesService;
    @RequirePermission(value = "m:roles")
    @RequestMapping("/add")
    public UnionResult add(Roles roles) {
        return rolesService.addRole(roles);
    }
    @RequirePermission(value = "m:roles")
    @RequestMapping("/remove")
    public UnionResult remove(Roles roles) {
        return rolesService.removeRole(roles);
    }
    @RequirePermission(value = "m:roles")
    @RequestMapping("/get")
    public UnionResult get() {
        return rolesService.getRoles();
    }
    @RequirePermission(value = "m:roles")
    @RequestMapping("/update")
    public UnionResult update(Roles roles) {
        return rolesService.updateRole(roles);
    }
}
